<script src="{{ getAssets }}js/amazeui.datatables.min.js?v={{ assets_version }}"></script>

<script>
var tables = $('#dataTables').DataTable({
    "sAjaxSource" : ''
    ,"bLengthChange": false
    ,"fnServerData" : function(sSource, aoData, fnCallback) {
        var params = checkQueryTableData(aoData);
        $.post(sSource, JSON.stringify(params),function(resp) {
            fnCallback(resp);
        },'json')
    }
    ,columns: [
        {"mDataProp" : "Id", "bSortable": false}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return productTypeidName(full.Products.TypeId);
        }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
            return productGroupName(full.Products);
        }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.sph;
        }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.cyl;
        }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.add;
        }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.model;
        }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.color;
        }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.size;
        }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.function_info;
        }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.film_color;
        }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.genre;
        }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Products.Spec;
        }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Acceptance.lot_number;
         }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Acceptance.manufacture_date > 0 ? timetransDate(full.Acceptance.manufacture_date) : '';
        }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
            return full.Acceptance.expiry_date > 0 ? timetransDate(full.Acceptance.expiry_date) : '';
        }}
        ,{"data" : "StorageNum", "bSortable": false}
    ]
    ,"serverSide": true
    ,"bPaginate" : false
    ,"bFilter" : false	//是否启动过滤、搜索功能
    ,"bInfo" : false //是否显示页脚信息，DataTables插件左下角显示记录数
    ,"bProcessing" : true //DataTables载入数据时，是否显示‘进度’提示
});
$('#delline').click(function(){
    parent.layer.closeAll();
    return false;
});
var flowing_id = '{{.flowing_id}}';
$('#submitBtn').click(function () {
    layer.confirm('确定需要冲红此单据吗？', function(){
        $.post('{{ urlfor "EntryreturnController.SaveFlushing" }}', {'flowing_id':flowing_id}, function (res) {
            if(res.code == 1) {
                layer.alert(res.msg);
                return false;
            } else {
                layer.alert("冲红成功", function(){
                    parent.dialogClose();
                });
            }
        });
    });
    return false;
});
</script>